-
Notifications
You must be signed in to change notification settings - Fork 20.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eth: send big transactions by announce/retrieve only #27618
eth: send big transactions by announce/retrieve only #27618
Conversation
Co-authored-by: Martin Holst Swende <martin@swende.se>
@@ -45,6 +45,10 @@ const ( | |||
// txChanSize is the size of channel listening to NewTxsEvent. | |||
// The number is referenced from the size of tx pool. | |||
txChanSize = 4096 | |||
// txMaxBroadcastSize is the max size of a transaction that will be broadcasted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need a newline above this :P
@@ -564,8 +568,11 @@ func (h *handler) BroadcastTransactions(txs types.Transactions) { | |||
// Broadcast transactions to a batch of peers not knowing about it | |||
for _, tx := range txs { | |||
peers := h.peers.peersWithoutTransaction(tx.Hash()) | |||
var numDirect int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above this too :P
// txMaxBroadcastSize is the max size of a transaction that will be broadcasted. | ||
// All transactions with a higher size will be announced and need to be fetched | ||
// by the peer. | ||
txMaxBroadcastSize = 4096 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason for setting is as 4K? Or just an arbitrary number.
Lots of deployment transaction will exceed this threshold though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I would completely remove the notion of transaction broadcasts altogether. With all the MEV infrastructure in place currently, there's not much value in trying to be 0.5ms faster at propagating a transaction.
As for deploys, probably nobody will want to front run them anyway so those are even less time sensitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only catch is that this mechanism places quite a big initial burden on the node issuing the transaction, since all it's peers will want to retrieve it from this one place initially since nobody else has it. For that, perhaps we'd need a slightly smarter announcer that does it in stages, delaying announcing to everyone.
E.g. Announce to sqrt(peers), wait 100-200ms, repeat. That way by the time we "fill" announce to all our peers, most of them will have announcements maybe from other peers too, thus not hammering only the source for the data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, look goods to me.
* eth: send big transactions by announce/retrieve only * Update eth/handler.go Co-authored-by: Martin Holst Swende <martin@swende.se> * eth: remove superfluous bracket * eth: add whitespace --------- Co-authored-by: Martin Holst Swende <martin@swende.se>
No description provided.